package seismosurfer.gui.panel;

import seismosurfer.data.MacroData;

/**
 * This AttributesPanel shows the attributes of the 
 * macroseismic layer objects.
 *
 */
public class MacroseismicPanel extends AttributesPanel {
    
    private static final long serialVersionUID = -3419451154062228439L;

    public String masterTableHeaders[] = { CATALOG_NAME,

    MACRO_ID, INTENSITY, INTENSITY_CHAR, AZIMUTH, DISTANCE, HYP_DISTANCE,

    NAME_GR, NAME_EN, NAME_GR_KAPOD, PREFECTURE_GR, PREFECTURE_EN, POPULATION,
            COUNTRY_NAME, LATITUDE, LONGITUDE

    };

    public MacroseismicPanel(String name) {

        super(name, false);

        setMasterTableHeaders(masterTableHeaders);
        createPanel();
    }

    public void setAttributes(Object data) {

        System.out
                .println("masterTable RowCount :" + masterTable.getRowCount());

        if (data instanceof MacroData) {
            MacroData md = (MacroData) data;

            masterTable.setValueAt(md.getCatalogName(), 0, 0);

            masterTable.setValueAt(new Long(md.getMacroseismicID()), 1, 0);
            masterTable.setValueAt(new Float(md.getIntensity()), 2, 0);
            masterTable.setValueAt(md.getIntensityChar(), 3, 0);
            masterTable.setValueAt(new Float(md.getAzimuth()), 4, 0);
            masterTable.setValueAt(new Float(md.getDistance()), 5, 0);
            masterTable.setValueAt(new Float(md.getHypocenterDistance()), 6, 0);

            masterTable.setValueAt(md.getSiteNameGR(), 7, 0);
            masterTable.setValueAt(md.getSiteNameEN(), 8, 0);
            masterTable.setValueAt(md.getSiteNameGRKapod(), 9, 0);
            masterTable.setValueAt(md.getPrefectureGR(), 10, 0);
            masterTable.setValueAt(md.getPrefectureEN(), 11, 0);
            masterTable.setValueAt(new Integer(md.getPopulation()), 12, 0);
            masterTable.setValueAt(md.getCountryName(), 13, 0);
            masterTable.setValueAt(new Float(md.getSiteLatitude()), 14, 0);
            masterTable.setValueAt(new Float(md.getSiteLongitude()), 15, 0);

        }

    }

}
